package com.settlement.system.model.entity.common;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.settlement.system.converter.BeforeOrAfterTicketConvert;
import com.settlement.system.converter.ShareOrNotConvert;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 收退款-凭证类型
 * @author Ximi
 * @since 2020-07-06
 */
@Data
@ExcelIgnoreUnannotated
@HeadStyle(fillBackgroundColor = 9,fillForegroundColor = 9)
@HeadRowHeight(value = 20)
@HeadFontStyle(fontHeightInPoints = 14)
public class TblRrVoucherType extends BaseModel implements Serializable {

    /**
     * 排序
     */
    @ColumnWidth(7)
    @ExcelProperty(value = "排序")
    @ApiModelProperty(value = "排序")
    @NotBlank(message = "排序不能为空")
    @Length(max = 10,message = "长度不能大于10")
    @Pattern(regexp="^([0-9]{1,}[\\.[0-9]]*)$",message="排序为数字")
    private String sort;

    /**
     * 凭证类型
     */
    @ColumnWidth(28)
    @ExcelProperty(value = "凭证类型")
    @ApiModelProperty(value = "凭证类型")
    @NotBlank(message = "凭证类型不能为空")
    private String voucherType;

    /**
     * 科目编号
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "科目编号")
    @ApiModelProperty(value = "科目编号")
    private String subjectNo;

    /**
     * 一级科目编码及名称
     */
    @ColumnWidth(28)
    @ExcelProperty(value = "一级科目编码及名称")
    @ApiModelProperty(value = "一级科目编码及名称")
    private String fristGradeSubjectNo;

    /**
     * 科目名称
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "科目名称")
    @ApiModelProperty(value = "科目名称")
    private String subjectName;

    /**
     * 借贷方向
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "借贷方向")
    @ApiModelProperty(value = "借贷方向")
    private String borrowOrLoan;

    /**
     * 账单金额方向
     */
    @ColumnWidth(19)
    @ExcelProperty(value = "账单金额方向")
    @ApiModelProperty(value = "账单金额方向")
    private String billAmountDirection;

    /**
     * 税率
     */
    @ColumnWidth(7)
    @ExcelProperty(value = "税率")
    @ApiModelProperty(value = "税率")
    private BigDecimal taxRate;



    /**
     * 计算凭证金额
     */
    @ColumnWidth(25)
    @ExcelProperty(value = "计算凭证金额")
    @ApiModelProperty(value = "计算凭证金额")
    private String calculateAmount;

    /**
     * 是否分摊
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "是否分摊",converter= ShareOrNotConvert.class)
    @ApiModelProperty(value = "是否分摊(1,是,  0否)")
    @NotEmpty(message = "是否分摊不能为空")
    @Pattern(regexp="^[0-1]{1}$",message="【是否分摊】的值只能为 [是]或[否]")
    private String shareOrNot;

    /**
     * 票前票后
     */
    @ColumnWidth(13)
    @ExcelProperty(value = "票前票后",converter = BeforeOrAfterTicketConvert.class)
    @ApiModelProperty(value = "票前票后(1,票前,  2票后,  3不涉及)")
    @NotEmpty(message = "票前票后不能为空")
    @Pattern(regexp="^[1-3]{1}$",message="【票前票后】的值只能是[票前]或[票后]或[不涉及]")
    private String beforeOrAfterTicket;



}
